package cn.fintecher.pangolin.entity.mysql;

import cn.fintecher.pangolin.common.enums.State;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;
import java.util.Set;

/**
 * @Author wangxiangdong
 * @Description 合规检查
 * @Date 2019/10/19 9:31
 **/
@Data
@Entity
@Table(name = "compliance_check")
@ApiModel(value = "合规检查")
public class ComplianceCheck extends BaseEntity{

    @ApiModelProperty(value = "配置名称")
    private String configName;

    @ApiModelProperty(value = "状态")
    private State  status;

    @ApiModelProperty(value = "配置的委托方")
    @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
    @JoinColumn(name = "check_id")
    private Set<SimplePrincipal> principals;

    @ApiModelProperty(value = "配置的用户")
    @OneToMany(cascade =CascadeType.ALL,fetch = FetchType.EAGER)
    @JoinColumn(name = "check_id")
    private Set<SimpleUser> target;

    @ApiModelProperty(value = "资源集合")
    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "check_resource", joinColumns = @JoinColumn(name = "check_id"), inverseJoinColumns = @JoinColumn(name = "resource_id"))
    private Set<Resource> resources;

    @ApiModelProperty(value = "操作人")
    private String operator;

    @ApiModelProperty(value = "操作时间")
    private Date operateTime;

}
